home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / lang / c-part2 / 13158 < prev    next >
Encoding:
Internet Message Format  |  1996-08-05  |  1.5 KB

  1. Path: mail2news.demon.co.uk!genesis.demon.co.uk
  2. From: Lawrence Kirby <fred@genesis.demon.co.uk>
  3. Newsgroups: comp.unix.sco.programmer,comp.lang.c
  4. Subject: Re: Storing 20 character numbers
  5. Date: Thu, 04 Apr 96 23:06:37 GMT
  6. Organization: none
  7. Message-ID: <828659197snz@genesis.demon.co.uk>
  8. References: <DpB3sz.J9n@idm.com>
  9. Reply-To: fred@genesis.demon.co.uk
  10. X-NNTP-Posting-Host: genesis.demon.co.uk
  11. X-Newsreader: Demon Internet Simple News v1.27
  12. X-Mail2News-Path: genesis.demon.co.uk
  13.  
  14. In article <DpB3sz.J9n@idm.com> eck@idm.com "Eric Kurbat" writes:
  15.  
  16. >Hello folks!
  17. >        I've got a question that has probably been asked before, but I need
  18. >to ask it again... I apologize in advance for any redundancy.
  19. >
  20. >        Anyway, the question is, how do you store a 20 character integer
  21. >number in a non-character variable in C without losing any of the digits?
  22.  
  23. There is no guaranteed way to do this in a basic C variable. Even a system
  24. that supported 64 bit integers may fall just short of your needs (it can
  25. represent up to about 1.84E19).
  26.  
  27. >I did a little bit of playing around and a long double loses precision after
  28. >about 16 digits. Does anyone have any ideas?
  29.  
  30. You would have to use some sort of multiple-precision representation. What
  31. is best would depend on what operations you want to perform on these numbers.
  32.  
  33. -- 
  34. -----------------------------------------
  35. Lawrence Kirby | fred@genesis.demon.co.uk
  36. Wilts, England | 70734.126@compuserve.com
  37. -----------------------------------------
  38.